package app.blog.service;

import java.util.List;

import jodd.util.StringUtil;
import app.blog.entity.Article;
import app.blog.entity.Category;

public class Categories {
		public static String the_category(Article post) {
			StringBuilder output = new StringBuilder(20);
			for (Category cat : post.categories()) {
				output.append(cat.name);
				output.append(", ");
			}
			if (output.length() > 0) {
				return StringUtil.cutSuffix(output.toString(), ", ");
			}
			return "";
		}

		public static List<Category> root_categories() {
			return Category.roots();
		}

	}